import request from '@/config/axios'

export interface MaintainPostServiceTaskVO {
  id: number
  taskNumber: string
  internalRelationId: number
  creatorName: string
  customerName: string
  customerContacts: string
  customerMobile: string
  productNumber: string
  productInstallDate: string
  customerAddress: string
  dictPostType: number
  failureDescription: string
  failureHandling: string
  failureCause: string
  dictStatus: number
  dictServiceEvaluate: number
  materialsExpenses: number
  costOfLabor: number
  truckingExpense: number
  boardWages: number
  processCost: number
  quarterage: number
  quarterageSubsidy: number
  otherExpenses: number
  totalPrice: number
  returnTime: Date
  returnContacts: string
  returnResult: string
  fileName: string
  filePath: string
  dictTaskType: number
  orderNumber: string
  dictOrderType: number
  productName: string
  customerCode: string
  submitFlag: number
  childList: ChildType[]
  customerSignature: string
  signatureDate: string
}

interface ChildType {
  arriveSceneTime: string, //到达时间
  leaveSceneTime: string,  //离开时间
  workDayTotal: string,  //工作日总数
  staffName: string, //服务人员
  jobNumber: string, //工号
  serviceWorkTime: string, //服务工时
  customerMobile: string //联系电话
}

// 查询质量管理-维修管理-售后服务任务单列表
export const getMaintainPostServiceTaskPage = async (params) => {
  return await request.get({ url: `/quality/maintain-post-service-task/page`, params })
}

// 查询质量管理-维修管理-售后服务任务单详情
export const getMaintainPostServiceTask = async (id: number) => {
  return await request.get({ url: `/quality/maintain-post-service-task/get?id=` + id })
}

// 修改质量管理-维修管理-售后服务任务单
export const updateMaintainPostServiceTask = async (data: MaintainPostServiceTaskVO) => {
  return await request.put({ url: `/quality/maintain-post-service-task/update`, data })
}

// 导出质量管理-维修管理-售后服务任务单 Excel
export const exportMaintainPostServiceTask = async (params) => {
  return await request.download({ url: `/quality/maintain-post-service-task/export-excel`, params })
}
